Conversation
Guard `C .+= ΔP` with `!iszerotangent(ΔP)` in both `left_polar_pullback!` and `right_polar_pullback!` to handle the case where ΔP is `nothing`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace LAPACK trsyl!-based solver with a direct eigendecomposition approach when both arguments are the same Hermitian matrix (as in polar pullbacks). This avoids LAPACKException(1) for close eigenvalues. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add rrules/pullbacks for `project_hermitian!`, `project_antihermitian!`, and `project_isometric!` directly in each AD backend extension (ChainRulesCore, Enzyme, Mooncake). The hermitian/antihermitian pullbacks are self-adjoint, while the isometric pullback delegates to `left_polar_pullback!` with zero ΔP. Includes test utilities and tests for all three backends. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
How should I think of this if dA === darg?
There was a problem hiding this comment.
I also wondering if we can use a more general operation than broadcasted .+= to add f(darg) into dA. Has Mooncake a dedicated add! for tangents? Or do we start using VectorInterface.jl?
There was a problem hiding this comment.
Has Mooncake a dedicated add! for tangents?
Isn't that increment!!?
There was a problem hiding this comment.
What would make me hesitate to use increment!! is that this has already been arrayify'd, so therefore it's not entirely clear to me anymore what kind of object/guarantees on the interface we still have. In any case I'd be happy to pull in more VectorInterface methods, I do think there are some places here and there where it might make sense in any case, and reducing the number of functions seems useful
There was a problem hiding this comment.
This being said, I do agree this rule looks off, and I'm worried about the tests not capturing this. I'll try and have a look at the in-place testing facilities and see if I can make this fail somehow
Codecov Report❌ Patch coverage is
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
Fixes #99.
I played around a bit with also implementing the
project_isometric, but since that was taking more significant changes (possibly writing an actualsylvesterequation solver), I will leave that for a follow-up.Also, I'm not actually smart enough for Enzyme rules, so will also ignore that for now. (Additionally I'm not sure we need them in that case, so don't want to pollute this PR)